﻿namespace TC
{
    public class And_blueprint : TranslateBlueprint
    {
        public override editor.cfg.blueprint.Node OnTranslate(Node node)
        {
            And t = node as And;

            editor.cfg.blueprint.And re = new editor.cfg.blueprint.And();
            re.id = t.id;

            Port other = null;
            foreach(var i in t.items)
            {
                other = t.graph.GetConnect(i);
                if(other == null)
                {
                    re.inputs.Add(new editor.cfg.blueprint.ConstBool() { value = i.defaultValue });
                }
                else
                {
                    re.inputs.Add(new editor.cfg.blueprint.OutputPin() { nodeId = other.parent.id, pinName = other.name});
                }
            }
            return re;
        }
    }
}
